<include file="Public/head" title="搜索"/>
<include file="Public/back_head"/>
<div class="main">
    <div class="search_warp">
    	<form action="{:U('search')}" method="get">
        <label for="">
             <input type="text" name="keyword" placeholder="请输入要搜索的内容" class="search" value="{$Think.get.keyword}">
             <i class="iconfont icon-mp-search-copy search_icon"></i>
             <button class="search_submit">搜索</button>
        </label>
        </form>
    </div>
    <if condition="$list neq null">
	    <ul class="index_slider_warp">
	    	<foreach name="list" item="val">
			<li class="index_slider_list clear">
			    <a href="{:U('Goods/detail',array('id'=>$val['id']))}">
			        <div class="index_list_left" style="background-image: url({$val.goods_logo})"></div>
			        <div class="index_list_right clear">
			            <div class="index_list_title">{$val.goods_name}</div>
			            <div class="index_list_abstract">{$val.profile}</div>
			            <div class="index_list_money"><i class="iconfont icon-jiage-copy"></i><em class="price-display">{$val.price}</em></div>
			            <div class="index_list_shop">已售<span class="index_list_num price-display">{$val.sale_count|default=0}</span>辆</div>
			        </div>
			    </a>
			</li>
			</foreach>
	    </ul>
	    <div class="ajaxMore"></div>
    <else/>
    	<if condition="I('keyword') neq null">
	    <div class="slider_warp_img" style="display:block;">
	        <img src="__PUBLIC__/home/image/error_search.png" alt="">
	    </div>
	    </if>
    </if>
</div>
<script>
var page = 1;
var is_end = false;
$(function(){
	//滑动加载
 	$(window).scroll(function(){
 		var wheight = $(this).height();
 		var dheight = $(document).height();
 		var sheight = $(this).scrollTop();
 		if((wheight+sheight)+10>=dheight && !is_end){
 			page++;
 			$('.ajaxMore').html('加载中...');
 			add_more();
 		}
 	});
})
function add_more(){
	$.post(
		"{:U('')}",
		{page:page,keyword:'{$Think.get.keyword}'},
		function(data){
			if(data.status == '0'){
				is_end = true;
				$('.ajaxMore').html('加载完毕!');
			}else{
				$('.index_slider_warp').append(data);
			}
		}
	)
}
</script>
<include file="Public/foot"/>